package com.example.renshiguanli.mapper;

import com.example.renshiguanli.pojo.Contract;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ContractMapper {
//    查询所有
    List<Contract> findAllContract();
//    添加信息
    @Insert("insert into contract (id, workID, contractTerm,\n" +
            "                         beginContract, endContract, contractContent\n" +
            "        )\n" +
            "        values (#{id}, #{workID}, #{contractTerm},\n" +
            "               #{beginContract},#{endContract},#{contractContent}\n" +
            "               )")
    void addByContract(Contract contract);
//    根据id查询信息
    @Select("select * from contract where id=#{id}")
    Contract findId(Integer id);
//    修改信息
    @Update(" update contract\n" +
            "        set workID = #{workID},\n"+"contractTerm = #{contractTerm},\n" +
            "            beginContract = #{beginContract},\n" +
            "            endContract = #{endContract},\n" +
            "            contractContent = #{contractContent}\n" +
            "        where id = #{id} ")
    void updateByContract(Contract contract);
//    删除信息
    @Delete("delete from contract where id=#{id} ;")
    void deleteContract(Integer id);
//    查找信息
    List<Contract> query(String name);
}
